# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1IndexConfig do
  @moduledoc """
  The index configuration for this field.

  ## Attributes

  *   `ancestorField` (*type:* `String.t`, *default:* `nil`) - Output only. Specifies the resource name of the `Field` from which this field's index configuration is set (when `uses_ancestor_config` is true), or from which it *would* be set if this field had no index configuration (when `uses_ancestor_config` is false).
  *   `indexes` (*type:* `list(GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1Index.t)`, *default:* `nil`) - The indexes supported for this field.
  *   `reverting` (*type:* `boolean()`, *default:* `nil`) - Output only When true, the `Field`'s index configuration is in the process of being reverted. Once complete, the index config will transition to the same state as the field specified by `ancestor_field`, at which point `uses_ancestor_config` will be `true` and `reverting` will be `false`.
  *   `usesAncestorConfig` (*type:* `boolean()`, *default:* `nil`) - Output only. When true, the `Field`'s index configuration is set from the configuration specified by the `ancestor_field`. When false, the `Field`'s index configuration is defined explicitly.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :ancestorField => String.t() | nil,
          :indexes => list(GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1Index.t()) | nil,
          :reverting => boolean() | nil,
          :usesAncestorConfig => boolean() | nil
        }

  field(:ancestorField)
  field(:indexes, as: GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1Index, type: :list)
  field(:reverting)
  field(:usesAncestorConfig)
end

defimpl Poison.Decoder, for: GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1IndexConfig do
  def decode(value, options) do
    GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1IndexConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1IndexConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
